package com.lcj.hub.common.config;

import com.lcj.hub.common.handler.IpInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
@AllArgsConstructor
public class WebConfig implements WebMvcConfigurer {
    private final IpInterceptor ipInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                .addInterceptor(ipInterceptor)
                .addPathPatterns("/**"); // 注册 ipInterceptor，拦截所有请求

    }
}
